﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ClientBackBone.EDDN
{

    [Serializable]
    public class Commander
    {
        public static int minCredits = 0;
        public static int maxCredits = 0;
        public static DateTime firstData = DateTime.MaxValue;
        public static DateTime lastData = DateTime.MinValue;
        public static void BoundCommander(Commander commander)
        {
            if (commander.StackedCashValue > Commander.maxCredits)
            {
                Commander.maxCredits = commander.StackedCashValue;
            }
            if ((0 - commander.debt) < Commander.minCredits)
            {
                Commander.maxCredits = 0 - commander.debt;
            }
            if (commander.date > Commander.lastData)
            {
                Commander.lastData = commander.date;
            }
            if (commander.date < Commander.firstData)
            {
                Commander.firstData = commander.date;
            }
        }

        public string name { get; internal set; }
        public int credits { get; internal set; }
        public int debt { get; internal set; }
        public int currentShipId { get; internal set; }
        public bool alive { get; internal set; }
        public bool docked { get; internal set; }
        public string currentsystem { get; internal set; }
        public string currentStation { get; internal set; }
        public int cargocapacity { get; internal set; }
        public int shipValue { get; internal set; }
        public int cargoValue { get; internal set; }
        [TypeConverter(typeof(ExpandableObjectConverter))]        
        public Rank rank { get; internal set; }
        public DateTime date { get; internal set; }
        public int StackedShipValue
        {
            get
            {
                return this.debt + this.shipValue;
            }
        }
        public int StackedCargoValue
        {
            get
            {
                return this.StackedShipValue + this.cargoValue;
            }
        }
        public int StackedCashValue
        {
            get
            {
                return this.StackedCargoValue + this.credits;
            }
        }
    }

    [Serializable]
    public class Rank
    {
        public String combat_rating { 
               get{
                   String return_value = "";
                   switch(combat)
                   {
                        case 0: 
                            return_value = "Harmless";
                           break;
                        case 1: 
                            return_value = "Mostly Harmless";
                           break;
                        case 2: 
                            return_value = "Novice";
                           break;
                        case 3: 
                            return_value = "Competent";
                           break;
                        case 4: 
                            return_value = "Expert";
                           break;
                        case 5: 
                            return_value = "Master";
                           break;
                        case 6: 
                            return_value = "Dangerous";
                           break;
                        case 7: 
                            return_value = "Deadly";
                           break;
                        case 8: 
                            return_value = "Elite";
                           break;
                        default: 
                            return_value = "Unknown";
                           break;

                   }
                   return return_value;
               } }
        public String trade_rating { 
               get{
                   String return_value = "";
                   switch(trade)
                   {
                        case 0:
                           return_value = "Penniless";
                           break;
                        case 1:
                           return_value = "Mostly Penniless";
                           break;
                        case 2:
                           return_value = "Peddler";
                           break;
                        case 3:
                           return_value = "Dealer";
                           break;
                        case 4:
                           return_value = "Merchant";
                           break;
                        case 5:
                           return_value = "Broker";
                           break;
                        case 6:
                           return_value = "Entrepreneur";
                           break;
                        case 7:
                           return_value = "Tycoon";
                           break;
                        case 8: 
                            return_value = "Elite";
                           break;
                        default: 
                            return_value = "Unknown";
                           break;

                   }
                   return return_value;
               } }
        public String explore_rating { 
               get{
                   String return_value = "";
                   switch(explore)
                   {
                        case 0:
                           return_value = "Aimless";
                           break;
                        case 1:
                           return_value = "Mostly Aimless";
                           break;
                        case 2:
                           return_value = "Scout";
                           break;
                        case 3:
                           return_value = "Surveyor";
                           break;
                        case 4:
                           return_value = "Trailblazer";
                           break;
                        case 5:
                           return_value = "Pathfinder";
                           break;
                        case 6:
                           return_value = "Ranger";
                           break;
                        case 7:
                           return_value = "Pioneer";
                           break;
                        case 8:
                           return_value = "Elite";
                           break;
                        default: 
                            return_value = "Unknown";
                           break;

                   }
                   return return_value;
               } }
        public String crime_rating { 
               get{
                   String return_value = "";
                   switch(crime)
                   {
                        default: 
                            return_value = "Unknown";
                           break;

                   }
                   return return_value;
               } }
        public String service_rating { 
               get{
                   String return_value = "";
                   switch(service)
                   {
                         default: 
                            return_value = "Unknown";
                           break;

                   }
                   return return_value;
               } }
        public String empire_rating { 
               get{
                   String return_value = "";
                   switch(empire)
                   {
                       case 1:
                           return_value = "Outsider";
                           break;
                       case 2:
                           return_value = "Serf";
                           break;
                       case 3:
                           return_value = "Master";
                           break;
                       case 4:
                           return_value = "Squire";
                           break;
                       case 5:
                           return_value = "Knight";
                           break;
                       case 6:
                           return_value = "Lord";
                           break;
                       case 7:
                           return_value = "Baron";
                           break;
                       case 8:
                           return_value = "Viscount";
                           break;
                       case 9:
                           return_value = "Count";
                           break;
                       case 10:
                           return_value = "Earl";
                           break;
                       case 11:
                           return_value = "Marquis";
                           break;
                       case 12:
                           return_value = "Duke";
                           break;
                       case 13:
                           return_value = "Prince";
                           break;
                       case 14:
                           return_value = "King";
                           break;
                       default:
                           return_value = "Unknown";
                           break;

                   }
                   return return_value;
               } }
        public String federation_rating { 
               get{
                   String return_value = "";
                   switch(federation)
                   {
                        case 1:
                           return_value = "Recruit";
                           break;
                        case 2:
                           return_value = "Cadet";
                           break;
                        case 3:
                           return_value = "Midshipman";
                           break;
                        case 4:
                           return_value = "Petty Officer";
                           break;
                        case 5:
                           return_value = "Chief Petty Officer";
                           break;
                        case 6:
                           return_value = "Warrant Officer";
                           break;
                        case 7:
                           return_value = "Ensign";
                           break;
                        case 8:
                           return_value = "Lieutenant";
                           break;
                        case 9:
                           return_value = "Lieutenant Commander";
                           break;
                        case 10:
                           return_value = "Post Commander";
                           break;
                        case 11:
                           return_value = "Post Captain";
                           break;
                        case 12:
                           return_value = "Rear Admiral";
                           break;
                        case 13:
                           return_value = "Vice Admiral";
                           break;
                        case 14:
                           return_value = "Admiral";
                           break;
                        default: 
                            return_value = "Unknown";
                           break;

                   }
                   return return_value;
               } }
        public String power_rating { 
               get{
                   String return_value = "";
                   switch(power)
                   {
                        case 1: 
                            return_value = "Level 1";
                           break;
                        case 2: 
                            return_value = "Level 2";
                           break;
                        case 3: 
                            return_value = "Level 3";
                           break;
                        case 4: 
                            return_value = "Level 4";
                           break;
                        case 5: 
                            return_value = "Level 5";
                           break;
                        default: 
                            return_value = "Unknown";
                           break;

                   }
                   return return_value;
               } }
        public String cqc_rating { 
               get{
                   String return_value = "";
                   switch(cqc)
                   {
                       case 0: 
                            return_value = "Helpless";
                           break;
                        case 1:
                           return_value = "Mostly Helpless";
                           break;
                        case 2:
                           return_value = "Amateur";
                           break;
                        case 3:
                           return_value = "Semi Professional";
                           break;
                        case 4:
                           return_value = "Professional";
                           break;
                        case 5:
                           return_value = "Champion";
                           break;
                        case 6:
                           return_value = "Hero";
                           break;
                        case 7:
                           return_value = "Legend";
                           break;
                        case 8: 
                            return_value = "Elite";
                           break;
                        default: 
                            return_value = "Unknown";
                           break;

                   }
                   return return_value;
               } }

        public int combat { get; internal set; }
        public int trade { get; internal set; }
        public int explore { get; internal set; }
        public int crime { get; internal set; }
        public int service { get; internal set; }
        public int empire { get; internal set; }
        public int federation { get; internal set; }
        public int power { get; internal set; }
        public int cqc { get; internal set; }

        public int aliance { get; set; }

        public object aliance_rating { get; set; }
    }

    
}
